package io.acm.config;


import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;
import java.util.Date;

@Configuration
    public class MybatisDataHandler implements MetaObjectHandler {

      //  Date now = new Date();
        @Override
        public void insertFill(MetaObject metaObject) {
            Date now = new Date();
            this.strictInsertFill(metaObject, "createTime", Date.class, now);
            this.strictInsertFill(metaObject, "updateTime", Date.class, now);
        }

        @Override
        public void updateFill(MetaObject metaObject) {
            this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());

        }
    }

